﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt
{
	// Token: 0x0200009D RID: 157
	public class TCursorDeclStmt : TCustomSqlStatement
	{
		// Token: 0x060004C8 RID: 1224 RVA: 0x002FBE75 File Offset: 0x002FA075
		public void setKind(int i)
		{
			this.kind = i;
		}

		// Token: 0x060004C9 RID: 1225 RVA: 0x002FBE7E File Offset: 0x002FA07E
		public void setCursorParameterDeclarations(TParameterDeclarationList l)
		{
			this.cursorParameterDeclarations = l;
		}

		// Token: 0x060004CA RID: 1226 RVA: 0x002FBE87 File Offset: 0x002FA087
		public void setCursorName(TObjectName o)
		{
			this.cursorName = o;
		}

		// Token: 0x170000B9 RID: 185
		// (get) Token: 0x060004CC RID: 1228 RVA: 0x002FBE99 File Offset: 0x002FA099
		// (set) Token: 0x060004CB RID: 1227 RVA: 0x002FBE90 File Offset: 0x002FA090
		public virtual int Kind
		{
			get
			{
				return this.kind;
			}
			set
			{
				this.kind = value;
			}
		}

		// Token: 0x060004CD RID: 1229 RVA: 0x002FBEA1 File Offset: 0x002FA0A1
		public TCursorDeclStmt() : this(EDbVendor.dbvoracle)
		{
		}

		// Token: 0x060004CE RID: 1230 RVA: 0x002FBEAB File Offset: 0x002FA0AB
		public TCursorDeclStmt(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sst_cursordecl;
		}

		// Token: 0x060004CF RID: 1231 RVA: 0x002FBEC3 File Offset: 0x002FA0C3
		internal override void buildsql()
		{
		}

		// Token: 0x060004D0 RID: 1232 RVA: 0x002FBEC5 File Offset: 0x002FA0C5
		internal override void clear()
		{
		}

		// Token: 0x170000BA RID: 186
		// (get) Token: 0x060004D1 RID: 1233 RVA: 0x002FBEC7 File Offset: 0x002FA0C7
		// (set) Token: 0x060004D2 RID: 1234 RVA: 0x002FBECF File Offset: 0x002FA0CF
		public virtual TSelectSqlStatement Subquery
		{
			get
			{
				return this.subquery;
			}
			set
			{
				this.subquery = value;
			}
		}

		// Token: 0x060004D3 RID: 1235 RVA: 0x002FBED8 File Offset: 0x002FA0D8
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x060004D4 RID: 1236 RVA: 0x002FBEDF File Offset: 0x002FA0DF
		internal virtual void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x060004D5 RID: 1237 RVA: 0x002FBEE4 File Offset: 0x002FA0E4
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			base.doParseStatement(psql);
			if (this.CursorParameterDeclarations != null)
			{
				for (int i = 0; i < this.CursorParameterDeclarations.size(); i++)
				{
					this.TopStatement.SymbolTable.Push(new TSymbolTableItem(9, this, this.CursorParameterDeclarations.getParameterDeclarationItem(i)));
				}
			}
			if (this.subquery != null)
			{
				this.subquery.parsestatement(this, false);
			}
			else if (this.selectSqlNode != null)
			{
				this.subquery = new TSelectSqlStatement(this.dbvendor);
				this.subquery.rootNode = this.selectSqlNode;
				this.subquery.doParseStatement(this);
			}
			if (this.CursorParameterDeclarations != null)
			{
				for (int j = 0; j < this.CursorParameterDeclarations.size(); j++)
				{
					this.TopStatement.SymbolTable.Pop();
				}
			}
			return 0;
		}

		// Token: 0x060004D6 RID: 1238 RVA: 0x002FBFBA File Offset: 0x002FA1BA
		public override void init(object arg1)
		{
			if (arg1 is TSelectSqlStatement)
			{
				this.subquery = (TSelectSqlStatement)arg1;
				return;
			}
			if (arg1 is TSelectSqlNode)
			{
				this.selectSqlNode = (TSelectSqlNode)arg1;
			}
		}

		// Token: 0x170000BB RID: 187
		// (get) Token: 0x060004D8 RID: 1240 RVA: 0x002FBFEE File Offset: 0x002FA1EE
		// (set) Token: 0x060004D7 RID: 1239 RVA: 0x002FBFE5 File Offset: 0x002FA1E5
		public virtual TObjectName CursorName
		{
			get
			{
				return this.cursorName;
			}
			set
			{
				this.cursorName = value;
			}
		}

		// Token: 0x170000BC RID: 188
		// (get) Token: 0x060004D9 RID: 1241 RVA: 0x002FBFF6 File Offset: 0x002FA1F6
		// (set) Token: 0x060004DA RID: 1242 RVA: 0x002FBFFE File Offset: 0x002FA1FE
		public virtual TParameterDeclarationList CursorParameterDeclarations
		{
			get
			{
				return this.cursorParameterDeclarations;
			}
			set
			{
				this.cursorParameterDeclarations = value;
			}
		}

		// Token: 0x170000BD RID: 189
		// (get) Token: 0x060004DC RID: 1244 RVA: 0x002FC010 File Offset: 0x002FA210
		// (set) Token: 0x060004DB RID: 1243 RVA: 0x002FC007 File Offset: 0x002FA207
		public virtual TTypeName Rowtype
		{
			get
			{
				return this.rowtype;
			}
			set
			{
				this.rowtype = value;
			}
		}

		// Token: 0x170000BE RID: 190
		// (get) Token: 0x060004DE RID: 1246 RVA: 0x002FC021 File Offset: 0x002FA221
		// (set) Token: 0x060004DD RID: 1245 RVA: 0x002FC018 File Offset: 0x002FA218
		public virtual TObjectName CursorTypeName
		{
			get
			{
				return this.cursorTypeName;
			}
			set
			{
				this.cursorTypeName = value;
			}
		}

		// Token: 0x060004DF RID: 1247 RVA: 0x002FC029 File Offset: 0x002FA229
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x060004E0 RID: 1248 RVA: 0x002FC039 File Offset: 0x002FA239
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			if (this.CursorParameterDeclarations != null)
			{
				this.CursorParameterDeclarations.acceptChildren(v);
			}
			if (this.subquery != null)
			{
				this.subquery.acceptChildren(v);
			}
			v.postVisit(this);
		}

		// Token: 0x04001119 RID: 4377
		public const int kind_cursor_declaration = 1;

		// Token: 0x0400111A RID: 4378
		public const int kind_cursor_specification = 2;

		// Token: 0x0400111B RID: 4379
		public const int kind_cursor_body = 3;

		// Token: 0x0400111C RID: 4380
		public const int kind_ref_cursor_type_definition = 4;

		// Token: 0x0400111D RID: 4381
		private int kind = 1;

		// Token: 0x0400111E RID: 4382
		private TSelectSqlStatement subquery;

		// Token: 0x0400111F RID: 4383
		private TSelectSqlNode selectSqlNode;

		// Token: 0x04001120 RID: 4384
		private TObjectName cursorName;

		// Token: 0x04001121 RID: 4385
		private TParameterDeclarationList cursorParameterDeclarations;

		// Token: 0x04001122 RID: 4386
		private TTypeName rowtype;

		// Token: 0x04001123 RID: 4387
		private TObjectName cursorTypeName;
	}
}
